package nc.bs.sm.identityverify;

import nc.bs.framework.common.NCLocator;
import nc.bs.logging.Logger;
import nc.itf.uap.rbac.userpassword.IUserPasswordChecker;
import nc.vo.framework.rsa.Encode;
import nc.vo.pub.BusinessException;
import nc.vo.sm.UserVO;
import nc.vo.sm.login.LoginSessBean;
import nc.vo.uap.rbac.userpassword.PasswordSecurityLevelFinder;
import nc.vo.uap.rbac.userpassword.PasswordSecurityLevelVO;

public class StaticPasswordIAMode extends AbstractIAMode {
	Encode coder = null;

	private Encode getCodeTool() {
		if (coder == null)
			coder = new Encode();
		return coder;
	}

	public int verify(LoginSessBean lsb, UserVO userVO) {
		return 2;
	}

	private void processPwd(LoginSessBean lsb, UserVO user)
			throws BusinessException {
		PasswordSecurityLevelVO pwdlv = PasswordSecurityLevelFinder
				.getPWDLV(user);
		IUserPasswordChecker upchecher = (IUserPasswordChecker) NCLocator
				.getInstance().lookup(IUserPasswordChecker.class.getName());

		lsb.put("UserPwdValidateResult", upchecher.getPwdCheckMsg(user, pwdlv));
		String hinttip = upchecher.getValidateTip(user.getPwdparam(), pwdlv);
		if (hinttip == null)
			hinttip = "noMessage";
		lsb.put("validateHintTip", hinttip);
	}
}
